<style>
table{
	margin: 0 auto;
	width: 1098px;
}
.number{
	text-align: right;
}
.countyRow{
	font-style: italic;
	color:gray;
}
.stateRow{
	font-weight: bold;
}
table td {
	padding: 5px;
}
</style>
<script>
$(document).ready(function(){
	$('.countySignal').parent().parent().addClass('countyRow')
	$('.stateSignal').parent().parent().addClass('stateRow')
})
</script>
<center>
	<h1>QSI, INC</h1>
	<b>107 Schuler Drive</b><br/>
	<b>Bardstown, KY 400004</b>
	<br/>
	<b>Earned / UnEarned Summary</b><br/>
	<b>Start: <?php echo $model->startDay; ?>/<?php echo $model->startYear; ?>&nbsp;&nbsp;End: N/A</b>
</center>
<br/>
<?php 
$table = new CI_Table();
$table->set_template(array(
	'table_open'=>'<table border="1" cellpadding="0" cellspacing="0">'
));
$table->set_heading(array(
	'St','County','Earned','Earned Tax','Remaining','Remaining Tax'
));
foreach($data['items'] as $stateName=>$stateData){
	$table->add_row(array(
		array('data'=>$stateName.'<span class="stateSignal"></span>','colspan'=>2),
		array('data'=>$stateData['earned'],'class'=>'number'),
		array('data'=>$stateData['earnedTax'],'class'=>'number'),
		array('data'=>$stateData['remaining'],'class'=>'number'),
		array('data'=>$stateData['remainingTax'],'class'=>'number'),
	));
	foreach($stateData['items'] as $county=>$countyData){
		$table->add_row(array(
			'',$county.'<span class="countySignal"></span>',
			array('data'=>$countyData['earned'],'class'=>'number'),
			array('data'=>$countyData['earnedTax'],'class'=>'number'),
			array('data'=>$countyData['remaining'],'class'=>'number'),
			array('data'=>$countyData['remainingTax'],'class'=>'number'),
		));
	}
}
$table->add_row(array(
	array(
		'data'=>'All',
		'colspan'=>2
	),
	array('data'=>$data['earned'],'class'=>'number'),
	array('data'=>$data['earnedTax'],'class'=>'number'),
	array('data'=>$data['remaining'],'class'=>'number'),
	array('data'=>$data['remainingTax'],'class'=>'number'),
));

echo $table->generate();
?>
